/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.migracion.pool;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.antlr.stringtemplate.StringTemplate;

/**
 *
 * @author stevenziggiz
 */
public abstract class DriverConnectionPool {

    static String DATA_BASE_TYPE;
    
    public String user;
    public String password;
    private String dataBaseName;
    //Referencia de la Clase Driver
    String DRIVER_NAME;
    //URL de la conexión a base de datos
    StringTemplate URL;
    //Consults
    private String tablesList;
    private String columnsList;
    

    /**
     * Se encarga de realizar la conexión a Base de Datos con los parametros
     * suministrados anteriormente.
     *
     * @return Retorna la Conexión creada
     * @throws ClassNotFoundException Lanza un {@code ClassNotFoundException} si
     * el driver no existe o falla.
     * @throws SQLException Lanza un {@code SQLException} si la conexión no se
     * pudo realizar.
     */
    public Connection conectar() throws ClassNotFoundException, SQLException {
        //Carga la Clase JDBC DRIVER
        Class.forName(DRIVER_NAME);

        //Crea la conexión a la base de datos
        return DriverManager.getConnection(URL.toString(), user, password);
    }

    /**
     * @return the dataBaseName
     */
    public String getDataBaseName() {
        return dataBaseName;
    }

    /**
     * @param dataBaseName the dataBaseName to set
     */
    public void setDataBaseName(String dataBaseName) {
        this.dataBaseName = dataBaseName;
    }
    
    /**
     * @return the DATA_BASE_TYPE
     */
    public String getDATA_BASE_TYPE() {
        return DATA_BASE_TYPE;
    }

    /**
     * @return the tablesList
     */
    public String getTablesList() {
        return tablesList;
    }

    /**
     * @param tablesList the tablesList to set
     */
    public void setTablesList(String tablesList) {
        this.tablesList = tablesList;
    }

    /**
     * @return the columnsList
     */
    public String getColumnsList() {
        return columnsList;
    }

    /**
     * @param columnsList the columnsList to set
     */
    public void setColumnsList(String columnsList) {
        this.columnsList = columnsList;
    }
    
}
